package Dao;
 
import java.sql.*;
import Dao.DBConn;
import Model.TeacherBean;
 
public class TeacherDAO {
    private Connection conn; 
    public TeacherDAO() throws Exception {
        conn = DBConn.getConnection();
    }    
    // 添加新教练
    public void insertTeacher(TeacherBean teacher) throws Exception{
    	String sql = "insert into teacher(TEACHER_ID,TEACHER_NAME) values(?,?)";
        try{
            PreparedStatement prestmt = conn.prepareStatement(sql);
            prestmt.setInt(1, teacher.getTeacherID());
            prestmt.setString(2, teacher.getTeacherName());
            
            prestmt.execute();
            prestmt.close();
            conn.close();
        }catch (Exception e){
            e.getMessage();
        }
    }
 
}